package school30.io.fs;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.file.FileConnection;
import school30.io.FileConnector;
import school30.io.FileReader;
import school30.io.FileWriter;

public class FsWriter extends FileWriter{
    FileConnection fc;
    OutputStream os;

    public FsWriter(FileConnection fc)
    {
        try {
            this.fc = fc;
            this.os = fc.openOutputStream();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    public void close() {
        try {
            fc.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    public int write(byte[] b) {
        try {
            os.write(b);
            return 0;
        } catch (IOException ex) {
            ex.printStackTrace();
            return -1;
        }
    }
}
